import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttrResultVO, AttrResultForm, AttrResultQuery } from '@/api/module/product/attrResult/types';

/**
 * 查询商品属性详情列表
 * @param query
 * @returns {*}
 */

export const listAttrResult = (query?: AttrResultQuery): AxiosPromise<AttrResultVO[]> => {
  return request({
    url: '/module/attrResult/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商品属性详情详细
 * @param id
 */
export const getAttrResult = (id: string | number): AxiosPromise<AttrResultVO> => {
  return request({
    url: '/module/attrResult/' + id,
    method: 'get'
  });
};

/**
 * 新增商品属性详情
 * @param data
 */
export const addAttrResult = (data: AttrResultForm) => {
  return request({
    url: '/module/attrResult',
    method: 'post',
    data: data
  });
};

/**
 * 修改商品属性详情
 * @param data
 */
export const updateAttrResult = (data: AttrResultForm) => {
  return request({
    url: '/module/attrResult',
    method: 'put',
    data: data
  });
};

/**
 * 删除商品属性详情
 * @param id
 */
export const delAttrResult = (id: string | number | Array<string | number>) => {
  return request({
    url: '/module/attrResult/' + id,
    method: 'delete'
  });
};
